# This dockerfile is specific to building Multus admission controller for OpenShift
FROM openshift/golang-builder@sha256:4820580c3368f320581eb9e32cf97aeec179a86c5749753a14ed76410a293d83 AS builder
ENV __doozer=update BUILD_RELEASE=202202211128.p0.gd7a7fe5.assembly.stream BUILD_VERSION=v4.10.0 OS_GIT_MAJOR=4 OS_GIT_MINOR=10 OS_GIT_PATCH=0 OS_GIT_TREE_STATE=clean OS_GIT_VERSION=4.10.0-202202211128.p0.gd7a7fe5.assembly.stream SOURCE_GIT_TREE_STATE=clean 
ENV __doozer=merge OS_GIT_COMMIT=d7a7fe5 OS_GIT_VERSION=4.10.0-202202211128.p0.gd7a7fe5.assembly.stream-d7a7fe5 SOURCE_DATE_EPOCH=1645440817 SOURCE_GIT_COMMIT=d7a7fe5df9f6303487475767acbb5228e8135af3 SOURCE_GIT_TAG=d7a7fe5 SOURCE_GIT_URL=https://github.com/openshift/multus-admission-controller 

# Add everything
ENV PKG_NAME=github.com/k8snetworkplumbingwg/net-attach-def-admission-controller
ENV PKG_PATH=/go/src/$PKG_NAME
ENV GO111MODULE=off
RUN mkdir -p $PKG_PATH

COPY . $PKG_PATH/
WORKDIR $PKG_PATH
# RUN go install ./...
RUN ./build.sh

WORKDIR /

FROM openshift/ose-base:v4.10.0-202202160023.p0.g544601e.assembly.stream
ENV __doozer=update BUILD_RELEASE=202202211128.p0.gd7a7fe5.assembly.stream BUILD_VERSION=v4.10.0 OS_GIT_MAJOR=4 OS_GIT_MINOR=10 OS_GIT_PATCH=0 OS_GIT_TREE_STATE=clean OS_GIT_VERSION=4.10.0-202202211128.p0.gd7a7fe5.assembly.stream SOURCE_GIT_TREE_STATE=clean 
ENV __doozer=merge OS_GIT_COMMIT=d7a7fe5 OS_GIT_VERSION=4.10.0-202202211128.p0.gd7a7fe5.assembly.stream-d7a7fe5 SOURCE_DATE_EPOCH=1645440817 SOURCE_GIT_COMMIT=d7a7fe5df9f6303487475767acbb5228e8135af3 SOURCE_GIT_TAG=d7a7fe5 SOURCE_GIT_URL=https://github.com/openshift/multus-admission-controller 
COPY --from=builder /go/src/github.com/k8snetworkplumbingwg/net-attach-def-admission-controller/bin/webhook /usr/bin/


CMD ["/usr/bin/webhook"]

LABEL \
        io.k8s.display-name="Container Networking Plugins" \
        io.k8s.description="This is a component of OpenShift Container Platform and provides an admission controller for Multus CNI custom resources." \
        io.openshift.tags="openshift" \
        maintainer="Doug Smith <dosmith@redhat.com>" \
        name="openshift/ose-multus-admission-controller" \
        com.redhat.component="ose-multus-admission-controller-container" \
        io.openshift.maintainer.product="OpenShift Container Platform" \
        io.openshift.maintainer.component="Networking" \
        io.openshift.maintainer.subcomponent="multus" \
        release="202202211128.p0.gd7a7fe5.assembly.stream" \
        io.openshift.build.commit.id="d7a7fe5df9f6303487475767acbb5228e8135af3" \
        io.openshift.build.source-location="https://github.com/openshift/multus-admission-controller" \
        io.openshift.build.commit.url="https://github.com/openshift/multus-admission-controller/commit/d7a7fe5df9f6303487475767acbb5228e8135af3" \
        version="v4.10.0"

